<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>常用安装 | 天涯海阁</title><meta name="keywords" content="mysql,mongoDB,redis,git,docker"><meta name="author" content="kcyln"><meta name="copyright" content="kcyln"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><meta name="description" content="各种常用工具安装方法">
<meta property="og:type" content="article">
<meta property="og:title" content="常用安装">
<meta property="og:url" content="https://blog.kcyln.xyz/posts/f4956656/index.html">
<meta property="og:site_name" content="天涯海阁">
<meta property="og:description" content="各种常用工具安装方法">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg">
<meta property="article:published_time" content="2020-12-08T03:57:34.000Z">
<meta property="article:modified_time" content="2020-12-08T06:20:00.000Z">
<meta property="article:author" content="kcyln">
<meta property="article:tag" content="mysql">
<meta property="article:tag" content="mongoDB">
<meta property="article:tag" content="redis">
<meta property="article:tag" content="git">
<meta property="article:tag" content="docker">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg"><link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/kcyln/ImageHosting@latest/2020/12/07/9a938caffcb1a6968eab7f8e0cd6857b.png"><link rel="canonical" href="https://blog.kcyln.xyz/posts/f4956656/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//www.google-analytics.com" crossorigin="crossorigin"/><link rel="preconnect" href="//hm.baidu.com"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><meta name="baidu-site-verification" content="http://data.zz.baidu.com/urls?site=https://kcyln.gitee.io&amp;token=OxN6ShKmGLRo1lRY"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch.min.css"><script src="https://cdn.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch.min.js" defer></script><script async="async" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><script>(adsbygoogle = window.adsbygoogle || []).push({
  google_ad_client: 'ca-pub-4985175266208920',
  enable_page_level_ads: 'true'
});</script><script>var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?584bfa4db6126a105facde0677e4ef55";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script><script async="async" src="https://www.googletagmanager.com/gtag/js?id=G-CYJNKFDP03"></script><script>window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-CYJNKFDP03');
</script><script>var GLOBAL_CONFIG = { 
  root: '/',
  algolia: {"appId":"6PUFXLP7OS","apiKey":"999de1c071e733df1a6cc5d90b12b63a","indexName":"my_blog","hits":{"per_page":6},"languages":{"input_placeholder":"搜索文章","hits_empty":"找不到您查询的内容：${query}","hits_stats":"找到 ${hits} 条结果，用时 ${time} 毫秒"}},
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: true,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  ClickShowText: undefined,
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#121212","position":"bottom-left"},
  justifiedGallery: {
    js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
    css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
};

var saveToLocal = {
  set: function setWithExpiry(key, value, ttl) {
    const now = new Date()
    const expiryDay = ttl * 86400000
    const item = {
      value: value,
      expiry: now.getTime() + expiryDay,
    }
    localStorage.setItem(key, JSON.stringify(item))
  },

  get: function getWithExpiry(key) {
    const itemStr = localStorage.getItem(key)

    if (!itemStr) {
      return undefined
    }
    const item = JSON.parse(itemStr)
    const now = new Date()

    if (now.getTime() > item.expiry) {
      localStorage.removeItem(key)
      return undefined
    }
    return item.value
  }
}</script><script id="config_change">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2020-12-08 14:20:00'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(function () {  window.activateDarkMode = function () {
    document.documentElement.setAttribute('data-theme', 'dark')
    if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
    }
  }
  window.activateLightMode = function () {
    document.documentElement.setAttribute('data-theme', 'light')
   if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
    }
  }
  const autoChangeMode = 'false'
  const t = saveToLocal.get('theme')
  if (autoChangeMode === '1') {
    const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
    const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
    const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
    const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
    if (t === undefined) {
      if (isLightMode) activateLightMode()
      else if (isDarkMode) activateDarkMode()
      else if (isNotSpecified || hasNoSupport) {
        const now = new Date()
        const hour = now.getHours()
        const isNight = hour <= 6 || hour >= 18
        isNight ? activateDarkMode() : activateLightMode()
      }
      window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
        if (saveToLocal.get('theme') === undefined) {
          e.matches ? activateDarkMode() : activateLightMode()
        }
      })
    } else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else if (autoChangeMode === '2') {
    const now = new Date()
    const hour = now.getHours()
    const isNight = hour <= 6 || hour >= 18
    if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
    else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else {
    if (t === 'dark') activateDarkMode()
    else if (t === 'light') activateLightMode()
  }const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
   if (asideStatus === 'hide') {
     document.documentElement.classList.add('hide-aside')
   } else {
     document.documentElement.classList.remove('hide-aside')
   }
}})()</script><style type="text/css">#toggle-sidebar {bottom: 80px}</style><meta name="generator" content="Hexo 5.2.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="https://cdn.jsdelivr.net/gh/kcyln/ImageHosting@latest/2020/12/07/8b2bf57d105d56f23dc7d3fa1b08cd9a.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">15</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">21</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">4</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fas fa-book"></i><span> 文档</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/posts/f4956656/"><i class="fa-fw fas fa-cog"></i><span> 常用安装</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fas fa-heartbeat"></i><span> 娱乐</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page" href="/Gallery/"><i class="fa-fw fas fa-images"></i><span> 照片</span></a></li><li><a class="site-page" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url(https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg)"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">天涯海阁</a></span><span id="menus"><div id="search_button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fas fa-book"></i><span> 文档</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/posts/f4956656/"><i class="fa-fw fas fa-cog"></i><span> 常用安装</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fas fa-heartbeat"></i><span> 娱乐</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page" href="/Gallery/"><i class="fa-fw fas fa-images"></i><span> 照片</span></a></li><li><a class="site-page" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><span class="close" id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></span></span></nav><div id="post-info"><h1 class="post-title">常用安装</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2020-12-08T03:57:34.000Z" title="发表于 2020-12-08 11:57:34">2020-12-08</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2020-12-08T06:20:00.000Z" title="更新于 2020-12-08 14:20:00">2020-12-08</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Docs/">Docs</a></span></div><div class="meta-secondline"> <span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">1.8k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>7分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h2 id="ubuntu-18-04-下安装-MySQL"><a href="#ubuntu-18-04-下安装-MySQL" class="headerlink" title="ubuntu 18.04 下安装 MySQL"></a>ubuntu 18.04 下安装 MySQL</h2><h3 id="查看系统是否安装mysql"><a href="#查看系统是否安装mysql" class="headerlink" title="查看系统是否安装mysql"></a>查看系统是否安装mysql</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo netstat -tap | grep mysql</span><br></pre></td></tr></table></figure>

<h3 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get install mysql-server mysql-client</span><br></pre></td></tr></table></figure>

<h3 id="配置"><a href="#配置" class="headerlink" title="配置"></a>配置</h3><ol>
<li><p>登录mysql</p>
<ul>
<li>开始安装的不知道mysql的登录密码，可以使用下列命令查看，然后登录<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo cat /etc/mysql/debian.cnf  <span class="comment"># 使用client下的user和password登录</span></span><br></pre></td></tr></table></figure>
<img src="https://cdn.jsdelivr.net/gh/kcyln/ImageHosting@latest/2020/08/07/9e27653a820905113db76b4d68733f41.png"></li>
<li>或者也可以直接输入 <code>sudo mysql</code> 登录</li>
</ul>
</li>
<li><p>修改root用户密码</p>
 <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ALTER USER &#39;root&#39;@&#39;localhost&#39; IDENTIFIED WITH mysql_native_password BY &#39;new-password&#39;;</span><br></pre></td></tr></table></figure>
</li>
<li><p>添加新用户</p>
 <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">GRANT ALL PRIVILEGES ON *.* TO &#39;root&#39;@&#39;%&#39; IDENTIFIED BY &#39;mypassword&#39; ;</span><br><span class="line">FLUSH PRIVILEGES;</span><br></pre></td></tr></table></figure>

</li>
</ol>
<blockquote>
<p>踩坑</p>
</blockquote>
<p><strong>问题：</strong> 关于远程连接时遇到的问题，设置了远程连接账号，开放了3306端口， 本地Navicat无法连接<br><strong>解答：</strong> 检查发现需要修改配置文件 将 bind-address 127.0.0.1 注释掉</p>
<h2 id="ubuntu-18-04下安装-MongoDB"><a href="#ubuntu-18-04下安装-MongoDB" class="headerlink" title="ubuntu 18.04下安装 MongoDB"></a>ubuntu 18.04下安装 MongoDB</h2><blockquote>
<p>建议查看官方文档： <a target="_blank" rel="noopener external nofollow noreferrer" href="https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/index.html">https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/index.html</a></p>
</blockquote>
<ol>
<li><p>导入MongoDB的包公钥</p>
 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5</span><br></pre></td></tr></table></figure>
</li>
<li><p>创建源列表文件</p>
 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">echo</span> <span class="string">&quot;deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse&quot;</span> | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list</span><br></pre></td></tr></table></figure>

 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get update</span><br><span class="line">sudo apt-get install -y mongodb-org</span><br></pre></td></tr></table></figure>


</li>
</ol>
<h2 id="ubuntu-18-04下安装-Redis"><a href="#ubuntu-18-04下安装-Redis" class="headerlink" title="ubuntu 18.04下安装 Redis"></a>ubuntu 18.04下安装 Redis</h2><h3 id="安装-1"><a href="#安装-1" class="headerlink" title="安装"></a>安装</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">sudo wget http://download.redis.io/releases/redis-5.0.5.tar.gz</span><br><span class="line">tar -zxvf redis-5.0.5.tar.gz</span><br><span class="line">sudo mv ./redis-5.0.5 /usr/<span class="built_in">local</span>/redis</span><br><span class="line"><span class="built_in">cd</span> /usr/<span class="built_in">local</span>/redis/</span><br><span class="line">sudo make  <span class="comment"># 生成</span></span><br><span class="line">sudo make <span class="built_in">test</span>  <span class="comment"># 测试</span></span><br><span class="line">sudo make install  <span class="comment"># 安装，将redis命令安装到/usr/local/bin目录</span></span><br><span class="line">sudo cp /usr/<span class="built_in">local</span>/redis/redis.conf /etc/redis/</span><br></pre></td></tr></table></figure>

<h3 id="配置-1"><a href="#配置-1" class="headerlink" title="配置"></a>配置</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /etc/redis/</span><br><span class="line">vi redis.conf</span><br><span class="line">daemonize yes  <span class="comment"># 设置守护进程</span></span><br><span class="line"><span class="comment"># 设置日志目录，目录和文件需要先手动创建好</span></span><br><span class="line">dir /var/lib/redis </span><br><span class="line">logfile <span class="string">&quot;/var/log/redis/redis-server.log&quot;</span></span><br></pre></td></tr></table></figure>

<h3 id="启动服务"><a href="#启动服务" class="headerlink" title="启动服务"></a>启动服务</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo redis-server /etc/redis/redis.conf</span><br></pre></td></tr></table></figure>

<h3 id="设置开机启动"><a href="#设置开机启动" class="headerlink" title="设置开机启动"></a>设置开机启动</h3><ol>
<li><p>将redis服务脚本(/usr/local/redis/utils/redis_init_script)复制到 /etc/init.d目录下</p>
 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo cp /usr/<span class="built_in">local</span>/redis/utils/redis_init_script /etc/init.d</span><br></pre></td></tr></table></figure>
</li>
<li><p>将服务脚本改名为redis并修改配置信息，本次只修改了一个  CONF=”/etc/redis/redis.conf”</p>
<p> ​<img src="https://cdn.jsdelivr.net/gh/kcyln/ImageHosting@latest/2020/08/07/3be4ae2bf5dbbe030d2cf2ba83ca6426.png"></p>
</li>
<li><p>给文件执行权限 </p>
 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo chmod +x /etc/init.d/redis</span><br></pre></td></tr></table></figure>
</li>
<li><p>加入服务，开机自启</p>
<ul>
<li><p>第一次 <code>chkconfig --add redis</code> 提示未找到命令</p>
</li>
<li><p>使用第二种方法 <code>sudo update-rc.d redis defaults</code> 成功</p>
</li>
<li><p>之后使用命令 <code>sudo service redis start | stop | restart</code> 即可</p>
</li>
</ul>
</li>
</ol>
<p><strong>参考链接：</strong>  <a target="_blank" rel="noopener external nofollow noreferrer" href="https://blog.csdn.net/qq_42403743/article/details/81358676">https://blog.csdn.net/qq_42403743/article/details/81358676</a></p>
<p>   ​ <a target="_blank" rel="noopener external nofollow noreferrer" href="https://jingyan.baidu.com/article/ca41422f3fa2421eae99edd2.html">https://jingyan.baidu.com/article/ca41422f3fa2421eae99edd2.html</a></p>
<blockquote>
<p>踩坑</p>
</blockquote>
<ul>
<li><p>输入 sudo make test 时报错</p>
<p>  <img src="https://cdn.jsdelivr.net/gh/kcyln/ImageHosting@latest/2020/08/07/746bfd9ac6400194a152a83e9d5b87d2.png"></p>
<p>  <strong>解决方法</strong>： 安装tcl，按照下面安装后问题解决</p>
  <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">sudo wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz</span><br><span class="line">sudo tar xzvf tcl8.6.1-src.tar.gz -C /usr/<span class="built_in">local</span>/</span><br><span class="line"><span class="built_in">cd</span> /usr/<span class="built_in">local</span>/tcl8.6.1/unix/</span><br><span class="line">sudo ./configure</span><br><span class="line">sudo make</span><br><span class="line">sudo make install</span><br></pre></td></tr></table></figure>
<p>  PS： 如果之后make test 还报错，可以重新运行几次make test 命令试试</p>
</li>
</ul>
<h2 id="ubuntu-18-04下安装-Git"><a href="#ubuntu-18-04下安装-Git" class="headerlink" title="ubuntu 18.04下安装 Git"></a>ubuntu 18.04下安装 Git</h2><h3 id="安装-2"><a href="#安装-2" class="headerlink" title="安装"></a>安装</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get install git </span><br></pre></td></tr></table></figure>

<h3 id="配置-2"><a href="#配置-2" class="headerlink" title="配置"></a>配置</h3><blockquote>
<p>基本命令</p>
</blockquote>
<ul>
<li><p><code>ssh-keygen -t rsa</code></p>
</li>
<li><p>将id_rsa.pub的内容复制到GitHub</p>
</li>
<li><p>验证是否成功     <code>ssh -T git@github.com</code></p>
</li>
</ul>
<blockquote>
<p>全局设置</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git config --global user.name <span class="string">&quot;yourusername&quot;</span></span><br><span class="line">git config --global user.email <span class="string">&quot;youremail&quot;</span></span><br></pre></td></tr></table></figure>

<blockquote>
<p>一台电脑同时连接github和gitee</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> ~/.ssh</span><br><span class="line">ssh-keygen -t rsa -C <span class="string">&quot;xxxx@email.com&quot;</span> -f <span class="string">&quot;github_id_rsa&quot;</span></span><br><span class="line">ssh-keygen -t rsa -C <span class="string">&quot;xxxx@email.com&quot;</span> -f <span class="string">&quot;gitee_id_rsa&quot;</span></span><br><span class="line"><span class="comment"># 将生成的公钥文件对应复制到github和gitee中，为了解决冲突，需要创建config文件</span></span><br><span class="line">touch ~/.ssh/config</span><br><span class="line"><span class="comment"># 文件内输入下列内容，完成后保存即可。</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># gitee</span></span><br><span class="line">Host gitee.com</span><br><span class="line">HostName gitee.com</span><br><span class="line">PreferredAuthentications publickey</span><br><span class="line">IdentityFile ~/.ssh/gitee_id_rsa</span><br><span class="line"></span><br><span class="line"><span class="comment"># github</span></span><br><span class="line">Host github.com</span><br><span class="line">HostName github.com</span><br><span class="line">PreferredAuthentications publickey</span><br><span class="line">IdentityFile ~/.ssh/github_id_rsa</span><br></pre></td></tr></table></figure>

<p>PS： 多台电脑使用同一的ssh文件，可以直接将.ssh文件夹复制到其他电脑，然后覆盖对应的目录。</p>
<h2 id="ubuntu-18-04下安装-Docker"><a href="#ubuntu-18-04下安装-Docker" class="headerlink" title="ubuntu 18.04下安装 Docker"></a>ubuntu 18.04下安装 Docker</h2><blockquote>
<p>建议查看官方文档： <a target="_blank" rel="noopener external nofollow noreferrer" href="https://docs.docker.com/engine/install/ubuntu/">https://docs.docker.com/engine/install/ubuntu/</a></p>
</blockquote>
<h3 id="使用存储库安装"><a href="#使用存储库安装" class="headerlink" title="使用存储库安装"></a>使用存储库安装</h3><ol>
<li><p>设置存储库</p>
<ul>
<li>更新apt软件包索引并安装软件包以允许apt通过HTTPS使用存储库<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get update</span><br><span class="line"></span><br><span class="line">sudo apt-get install \</span><br><span class="line">    apt-transport-https \</span><br><span class="line">    ca-certificates \</span><br><span class="line">    curl \</span><br><span class="line">    gnupg-agent \</span><br><span class="line">    software-properties-common</span><br></pre></td></tr></table></figure></li>
<li>添加Docker的官方GPG密钥<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -</span><br></pre></td></tr></table></figure></li>
<li>9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88通过搜索指纹的后8个字符，验证您现在是否拥有带有指纹的密钥<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-key fingerprint 0EBFCD88</span><br></pre></td></tr></table></figure></li>
<li>输出以下内容<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">pub   rsa4096 2017-02-22 [SCEA]</span><br><span class="line">      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88</span><br><span class="line">uid           [ unknown] Docker Release (CE deb) &lt;docker@docker.com&gt;</span><br><span class="line">sub   rsa4096 2017-02-22 [S]</span><br></pre></td></tr></table></figure></li>
<li>设置稳定的存储库<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">sudo add-apt-repository \</span><br><span class="line">  <span class="string">&quot;deb [arch=amd64] https://download.docker.com/linux/ubuntu \</span></span><br><span class="line"><span class="string">  <span class="subst">$(lsb_release -cs)</span> \</span></span><br><span class="line"><span class="string">  stable&quot;</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>安装DOCKER引擎</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 更新apt程序包索引，并安装最新版本的Docker Engine和容器</span></span><br><span class="line">sudo apt-get update</span><br><span class="line">sudo apt-get install docker-ce docker-ce-cli containerd.io</span><br></pre></td></tr></table></figure>
</li>
<li><p>以非root用户管理Docker</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo groupadd docker</span><br><span class="line">sudo usermod -aG docker <span class="variable">$USER</span></span><br></pre></td></tr></table></figure>

</li>
</ol>
<h3 id="使用脚本安装"><a href="#使用脚本安装" class="headerlink" title="使用脚本安装"></a>使用脚本安装</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo wget -qO- https://get.docker.com | sh  <span class="comment"># 自动下载安装docker命令</span></span><br><span class="line">sudo usermod -aG docker <span class="variable">$USER</span>  <span class="comment"># 给与docker权限，如果输入命令后不生效，可以重启系统后再试</span></span><br></pre></td></tr></table></figure>

<h3 id="docker基本命令"><a href="#docker基本命令" class="headerlink" title="docker基本命令"></a>docker基本命令</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">docker info  <span class="comment"># 查看docker信息</span></span><br><span class="line">docker pull <span class="comment"># 拉取镜像</span></span><br><span class="line">docker build <span class="comment"># 创建镜像</span></span><br><span class="line">docker run <span class="comment"># 运行容器</span></span><br><span class="line">docker images   <span class="comment"># 查看镜像</span></span><br><span class="line">docker ps  <span class="comment"># 查看运行中的容器</span></span><br><span class="line">docker ps -a  <span class="comment"># 查看所有容器</span></span><br><span class="line">docker stop sdai3nf  <span class="comment"># 停止容器</span></span><br><span class="line">docker rm ef87fse8  cf045930cd83 <span class="comment"># 删除停止的容器，可以同时删除多个容器</span></span><br><span class="line">docker rmi fd8efke  <span class="comment"># 删除镜像</span></span><br><span class="line">docker cp  <span class="comment"># 在宿主机和容器之间拷贝文件</span></span><br><span class="line">docker commit <span class="comment"># 保存改动为新的镜像</span></span><br><span class="line"></span><br><span class="line">docker run ubuntu <span class="built_in">echo</span> hello docker</span><br><span class="line">docker run -p -d 8080:80 nginx</span><br><span class="line">docker cp index.html cf045930cd83://usr/share/nginx/html</span><br><span class="line">docker commit -m <span class="string">&quot;hello&quot;</span> cf045930cd83 hello   <span class="comment"># 提交命令，保存容器的更改，会返回一个新的镜像;最后的hello是镜像名</span></span><br><span class="line">docker <span class="built_in">exec</span> -it nginx /bin/bash  <span class="comment"># 进入容器内部</span></span><br></pre></td></tr></table></figure>

<h3 id="Dockerfile"><a href="#Dockerfile" class="headerlink" title="Dockerfile"></a>Dockerfile</h3><figure class="highlight dockerfile"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">FROM</span>           <span class="comment"># 基础镜像</span></span><br><span class="line"><span class="keyword">RUN</span><span class="bash">            <span class="comment"># 执行命令</span></span></span><br><span class="line"><span class="keyword">ADD</span><span class="bash">            <span class="comment"># 添加文件,比COPY更强，可以复制远程文件</span></span></span><br><span class="line"><span class="keyword">COPY</span><span class="bash">           <span class="comment"># 拷贝文件</span></span></span><br><span class="line"><span class="keyword">CMD</span><span class="bash">            <span class="comment"># 执行命令,程序入口</span></span></span><br><span class="line"><span class="keyword">EXPOSE</span>         <span class="comment"># 暴露端口</span></span><br><span class="line"><span class="keyword">WORKDIR</span><span class="bash">        <span class="comment"># 指定路径 </span></span></span><br><span class="line"><span class="keyword">MAINTAINER</span>     <span class="comment"># 维护者</span></span><br><span class="line"><span class="keyword">ENV</span>            <span class="comment"># 设置环境变量</span></span><br><span class="line"><span class="keyword">ENTRYPOINT</span><span class="bash">     <span class="comment"># 容器入口,如果没有CMD,从这里启动，如果有,那CMD的内容就是这个的参数</span></span></span><br><span class="line"><span class="keyword">USER</span>           <span class="comment"># 指定用户</span></span><br><span class="line"><span class="keyword">VOLUME</span><span class="bash">         <span class="comment"># 挂载卷</span></span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">FROM</span> alpine:latest</span><br><span class="line"><span class="keyword">MAINTAINER</span> xxxx  // 容器作者</span><br><span class="line"><span class="keyword">CMD</span><span class="bash"> <span class="built_in">echo</span> <span class="string">&#x27;hello docker&#x27;</span></span></span><br><span class="line"></span><br><span class="line">// 运行命令创建镜像</span><br><span class="line">docker build -t hello .</span><br><span class="line">docker <span class="keyword">run</span><span class="bash"> hello  // 运行容器,输出内容</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">FROM</span> ubuntu</span><br><span class="line"><span class="keyword">MAINTAINER</span> xxxx</span><br><span class="line"><span class="keyword">RUN</span><span class="bash"> sed -i <span class="string">&#x27;s/archive.ubuntu.com/mirrors.ustc.edu.cn/g&#x27;</span> /etc/apt/sources.list</span></span><br><span class="line"><span class="keyword">RUN</span><span class="bash"> apt-get update</span></span><br><span class="line"><span class="keyword">RUN</span><span class="bash"> apt-get install -y nginx</span></span><br><span class="line"><span class="keyword">COPY</span><span class="bash"> index.html /var/www/html</span></span><br><span class="line"><span class="keyword">ENTRYPOINT</span><span class="bash"> [<span class="string">&quot;/usr/sbin/nginx&quot;</span>, <span class="string">&quot;-g&quot;</span>, <span class="string">&quot;daemon off;&quot;</span>]</span></span><br><span class="line"><span class="keyword">EXPOSE</span> <span class="number">80</span></span><br><span class="line"></span><br><span class="line">// 运行命令创建镜像</span><br><span class="line">docker build -t hello .</span><br><span class="line">docker <span class="keyword">run</span><span class="bash"> -d -p 8080:80 hello </span></span><br><span class="line">curl http://localhost:<span class="number">8080</span> </span><br></pre></td></tr></table></figure>

<h3 id="VOLUME"><a href="#VOLUME" class="headerlink" title="VOLUME"></a>VOLUME</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">docker run -v /usr/share/nginx/html nginx  // 挂载卷</span><br><span class="line">docker inspect nginx // 查看信息， 可以看到挂载卷宿主机的路径</span><br><span class="line"></span><br><span class="line">docker run -v <span class="variable">$PWD</span>/code:/usr/share/nginx/html nginx  // 挂载卷</span><br><span class="line"></span><br><span class="line">docker create -v <span class="variable">$PWD</span>/data:/var/mydata --name data_container ubuntu  // 创建一个用来提供数据的容器</span><br><span class="line">docker run --volumes-from data_container ubuntu  // 新的容器从data_container里加载数据</span><br><span class="line">docker run -it --volumes-from data_container ubuntu /bin.bash // 创建后可以直接进入容器内</span><br></pre></td></tr></table></figure>

<h3 id="Registry"><a href="#Registry" class="headerlink" title="Registry"></a>Registry</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">docker search ubuntu</span><br><span class="line">docker pull ubuntu</span><br><span class="line">docker push myname/ubuntu</span><br></pre></td></tr></table></figure>

<h3 id="docker-compose"><a href="#docker-compose" class="headerlink" title="docker-compose"></a>docker-compose</h3><ol>
<li>安装<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">curl -L https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m) &gt; /usr/<span class="built_in">local</span>/bin/docker-compose</span><br></pre></td></tr></table></figure></li>
<li>授权<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chmod a+x /usr/<span class="built_in">local</span>/bin/docker-compose // 给所有用户授权执行</span><br></pre></td></tr></table></figure></li>
<li>使用<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">docker-compose --version  // 查看版本</span><br><span class="line">docker-compose build  // 构建镜像</span><br><span class="line">docker-compose up -d  // 启动容器</span><br><span class="line">docker-compose stop  // 停止容器</span><br><span class="line">docker-compose rm  // 删除容器</span><br><span class="line">docker-compose ps</span><br></pre></td></tr></table></figure>

</li>
</ol>
<p>官方文档： <a target="_blank" rel="noopener external nofollow noreferrer" href="https://docs.docker.com/compose/">https://docs.docker.com/compose/</a><br>下载地址： <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/docker/compose/releases">https://github.com/docker/compose/releases</a></p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined" rel="external nofollow noreferrer">kcyln</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://blog.kcyln.xyz/posts/f4956656/">https://blog.kcyln.xyz/posts/f4956656/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow noreferrer" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://blog.kcyln.xyz" target="_blank">天涯海阁</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/mysql/">mysql</a><a class="post-meta__tags" href="/tags/mongoDB/">mongoDB</a><a class="post-meta__tags" href="/tags/redis/">redis</a><a class="post-meta__tags" href="/tags/git/">git</a><a class="post-meta__tags" href="/tags/docker/">docker</a></div><div class="post_share"><div class="social-share" data-image="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="next-post pull-full"><a href="/posts/ec1f4cbd/"><img class="next-cover" src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="onerror=null;src='/img/404.jpg'"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">python3下读取redis返回bytes类型的问题</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span> 相关推荐</span></div><div class="relatedPosts-list"><div><a href="/posts/ec1f4cbd/" title="python3下读取redis返回bytes类型的问题"><img class="cover" src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-09-23</div><div class="title">python3下读取redis返回bytes类型的问题</div></div></a></div><div><a href="/posts/9fd46b0b/" title="docker-compose启动后其中的web容器立刻停止"><img class="cover" src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-09-20</div><div class="title">docker-compose启动后其中的web容器立刻停止</div></div></a></div></div></div></div><div class="aside_content" id="aside_content"><div class="card-widget card-info"><div class="card-content"><div class="card-info-avatar is-center"><img class="avatar-img" src="https://cdn.jsdelivr.net/gh/kcyln/ImageHosting@latest/2020/12/07/8b2bf57d105d56f23dc7d3fa1b08cd9a.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">kcyln</div><div class="author-info__description">一分耕耘，一分收获。</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">15</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">21</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">4</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/kcyln"><i class="fab fa-github"></i><span>Github</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/kcyln" rel="external nofollow noreferrer" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:xxxxxx@gmail.com" rel="external nofollow noreferrer" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div></div><div class="card-widget card-announcement"><div class="card-content"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">Welcome to my Blog</div></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="card-content"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#ubuntu-18-04-%E4%B8%8B%E5%AE%89%E8%A3%85-MySQL"><span class="toc-number">1.</span> <span class="toc-text">ubuntu 18.04 下安装 MySQL</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9F%A5%E7%9C%8B%E7%B3%BB%E7%BB%9F%E6%98%AF%E5%90%A6%E5%AE%89%E8%A3%85mysql"><span class="toc-number">1.1.</span> <span class="toc-text">查看系统是否安装mysql</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85"><span class="toc-number">1.2.</span> <span class="toc-text">安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE"><span class="toc-number">1.3.</span> <span class="toc-text">配置</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ubuntu-18-04%E4%B8%8B%E5%AE%89%E8%A3%85-MongoDB"><span class="toc-number">2.</span> <span class="toc-text">ubuntu 18.04下安装 MongoDB</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ubuntu-18-04%E4%B8%8B%E5%AE%89%E8%A3%85-Redis"><span class="toc-number">3.</span> <span class="toc-text">ubuntu 18.04下安装 Redis</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-1"><span class="toc-number">3.1.</span> <span class="toc-text">安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE-1"><span class="toc-number">3.2.</span> <span class="toc-text">配置</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%90%AF%E5%8A%A8%E6%9C%8D%E5%8A%A1"><span class="toc-number">3.3.</span> <span class="toc-text">启动服务</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%BC%80%E6%9C%BA%E5%90%AF%E5%8A%A8"><span class="toc-number">3.4.</span> <span class="toc-text">设置开机启动</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ubuntu-18-04%E4%B8%8B%E5%AE%89%E8%A3%85-Git"><span class="toc-number">4.</span> <span class="toc-text">ubuntu 18.04下安装 Git</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-2"><span class="toc-number">4.1.</span> <span class="toc-text">安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE-2"><span class="toc-number">4.2.</span> <span class="toc-text">配置</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ubuntu-18-04%E4%B8%8B%E5%AE%89%E8%A3%85-Docker"><span class="toc-number">5.</span> <span class="toc-text">ubuntu 18.04下安装 Docker</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8%E5%AD%98%E5%82%A8%E5%BA%93%E5%AE%89%E8%A3%85"><span class="toc-number">5.1.</span> <span class="toc-text">使用存储库安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8%E8%84%9A%E6%9C%AC%E5%AE%89%E8%A3%85"><span class="toc-number">5.2.</span> <span class="toc-text">使用脚本安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#docker%E5%9F%BA%E6%9C%AC%E5%91%BD%E4%BB%A4"><span class="toc-number">5.3.</span> <span class="toc-text">docker基本命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Dockerfile"><span class="toc-number">5.4.</span> <span class="toc-text">Dockerfile</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#VOLUME"><span class="toc-number">5.5.</span> <span class="toc-text">VOLUME</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Registry"><span class="toc-number">5.6.</span> <span class="toc-text">Registry</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#docker-compose"><span class="toc-number">5.7.</span> <span class="toc-text">docker-compose</span></a></li></ol></li></ol></div></div></div><div class="card-widget card-recent-post"><div class="card-content"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/posts/f4956656/" title="常用安装"><img src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="常用安装"/></a><div class="content"><a class="title" href="/posts/f4956656/" title="常用安装">常用安装</a><time datetime="2020-12-08T03:57:34.000Z" title="发表于 2020-12-08 11:57:34">2020-12-08</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/ec1f4cbd/" title="python3下读取redis返回bytes类型的问题"><img src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="python3下读取redis返回bytes类型的问题"/></a><div class="content"><a class="title" href="/posts/ec1f4cbd/" title="python3下读取redis返回bytes类型的问题">python3下读取redis返回bytes类型的问题</a><time datetime="2020-09-22T16:00:00.000Z" title="发表于 2020-09-23 00:00:00">2020-09-23</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/9fd46b0b/" title="docker-compose启动后其中的web容器立刻停止"><img src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="docker-compose启动后其中的web容器立刻停止"/></a><div class="content"><a class="title" href="/posts/9fd46b0b/" title="docker-compose启动后其中的web容器立刻停止">docker-compose启动后其中的web容器立刻停止</a><time datetime="2020-09-19T16:00:00.000Z" title="发表于 2020-09-20 00:00:00">2020-09-20</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/942da6d9/" title="pip更换国内源"><img src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="pip更换国内源"/></a><div class="content"><a class="title" href="/posts/942da6d9/" title="pip更换国内源">pip更换国内源</a><time datetime="2020-08-18T16:00:00.000Z" title="发表于 2020-08-19 00:00:00">2020-08-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/ede1601b/" title="Git忽略规则(.gitignore配置）不生效原因和解决"><img src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Git忽略规则(.gitignore配置）不生效原因和解决"/></a><div class="content"><a class="title" href="/posts/ede1601b/" title="Git忽略规则(.gitignore配置）不生效原因和解决">Git忽略规则(.gitignore配置）不生效原因和解决</a><time datetime="2020-08-06T16:00:00.000Z" title="发表于 2020-08-07 00:00:00">2020-08-07</time></div></div></div></div></div></div></div></main><footer id="footer" style="background-image: url(https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg)"><div id="footer-wrap"><div class="copyright">&copy;2020 By kcyln</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener external nofollow noreferrer" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">Hi, welcome to my blog!</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="algolia-search"><div class="search-dialog"><div class="search-dialog__title" id="algolia-search-title">Algolia</div><div id="algolia-input-panel"><div id="algolia-search-input"></div></div><hr/><div id="algolia-search-results"><div id="algolia-hits"></div><div id="algolia-pagination"></div><div id="algolia-stats"></div></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script src="/js/search/algolia.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',()=> {preloader.endLoading()})</script><div class="js-pjax"><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><div class="aplayer no-destroy" data-id="153259573" data-server="netease" data-type="playlist" data-fixed="true" data-mini="true" data-listFolded="false" data-order="random" data-preload="none" data-autoplay="true" muted></div><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-nest.min.js"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors = [
  'title',
  '#config_change',
  '#body-wrap',
  '#rightside-config-hide',
  '#rightside-config-show',
  '.js-pjax'
]

if (false) {
  pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]')
}

var pjax = new Pjax({
  elements: 'a:not([target="_blank"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: true,
  scrollRestoration: false
})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  $('script[data-pjax]').each(function () {
    $(this).parent().append($(this).remove())
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  if (typeof gtag === 'function') {
    gtag('config', 'G-CYJNKFDP03', {'page_path': window.location.pathname});
  }

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // Analytics
  if (false) {
    MtaH5.pgv()
  }

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()

  typeof preloader === 'object' && preloader.endLoading()
})


document.addEventListener('pjax:send', function () {
  typeof preloader === 'object' && preloader.initLoading()
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  $(window).off('scroll')

  //reset readmode
  $('body').hasClass('read-mode') && $('body').removeClass('read-mode')

})</script></div></body></html>